<template>
  <van-row class="list-page" >
    <van-nav-bar
      :title="title"
      fixed
      placeholder
      left-arrow
      is-link
      @click-left="onClickLeft"
    />
    <van-row
      class="cell-bar"
      :key="indexDescription"
      v-for="(item, indexDescription) in QuestionMap[cid]"
    >
      <van-cell
        center
        is-link
        :title="item.QuestionTitle"
        @click="myCategoryClick(cid, indexDescription)"
      />
    </van-row>
  </van-row>
</template>

<script>
import {
  NavBar, Cell, CellGroup, Row,
} from 'vant';
import { mapActions, mapState } from 'vuex';
import request from '@/utils/request';

export default {
  name: 'list',
  components: {
    [NavBar.name]: NavBar,
    [CellGroup.name]: CellGroup,
    [Cell.name]: Cell,
    [Row.name]: Row,
  },
  data() {
    return {
      title: [],
      cid: '',
      myCategory: {},
    };
  },
  async created() {
    this.cid = this.$route.query.cid;
    this.title = this.$route.query.title;
  },
  computed: {
    ...mapState(['QuestionMap']),
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    async getQuestion() {
      const getQuestion = {
        header: {
          invoker: 'C0644172-3875-4941-B6D8-AAB26581083B',
          apiTag: 'helpcate',
          appId: 'E4C10B56-B15A-4C8C-B378-11FFDAE4FD6D',
          pkgName: 'com.sfsm.quickstartapp',
          ua: '',
          model: 'model',
          versionCode: 1,
          versionName: '5.5.5',
        },
        body: {
          categroyId: this.$route.params.id,
        },
      };
      const { data } = await request({
        url: '/api/CSAPI',
        method: 'POST',
        data: {
          ...getQuestion,
        },
      });
      if (data.Code !== 200) return;
      this.myCategory = data.Detail;
      // this.setParams(data.Detail);
    },
    myCategoryClick(cid, index) {
      this.$router.push({
        path: 'detailcustomerfeedback',
        query: {
          cid,
          index,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.van-nav-bar {
  position: fixed;
  width: 100%;
  left: 0px;
  top: 0px;
}

/deep/ .van-ellipsis {
  color: #3b3b3b;
  font-size: 19px;
}

/deep/ .van-nav-bar .van-icon {
  color: #3b3b3b;
}

.cell-bar {
  > * {
    line-height: 21px;
    font-size: 15px;
    color: #3b3b3b;
  }
}
</style>
